# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Contributor: Eivind Uggedal <eivind@uggedal.com>
# Maintainer: Steven Guikal <void@fluix.one>
pkgname=py3-flask-wtf
_pkgname=flask_wtf
pkgver=1.2.1
pkgrel=0
pkgdesc="Flask WTForms extension"
url="https://pypi.org/project/Flask-WTF"
arch="noarch"
license="BSD-3-Clause"
depends="python3 py3-flask py3-wtforms"
makedepends="py3-gpep517 py3-hatchling"
checkdepends="py3-pytest py3-wtforms-lang"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

replaces="py-flask-wtf" # Backwards compatibility
provides="py-flask-wtf=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
2a94482cd6aa6db42a6021dd8f03fc75d963b8bba2957652fb509088d63617d586ba459dbb0a22c647e22d72c8ba6a037d2018ef07630d9b8ef82fdddc45f940  flask_wtf-1.2.1.tar.gz
"
